<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<link rel="stylesheet" href="../../css/wangEditor.min.css" />
<div class="panel panel-default">
    <div class="panel-heading">
        <h3>{{title}}</h3>
    </div>
    <div class="panel-body">
        <div class="form-group">
            <label for="txtTitle">提案标题</label>
            <input class="form-control"
                   id="txtTitle"
                   type="text"
                   placeholder="请输入提案的标题"
                   ng-model="proposal.title" >
        </div>
        <div class="form-group">
            <label for="proposalType">提案类型</label>
            <select class="form-control" id="proposalType" ng-model="proposal.type">
                <option value="">---请选择---</option>
                <option value="0">教务</option>
                <option value="1">财务</option>
                <option value="2">管理</option>
                <option value="3">其他</option>
            </select>
        </div>
        <div>
            <div id="textEditor" style="width: 95%; min-height: 1000px; margin: auto">
                <p>请输入提案的内容……</p>
            </div>
        </div>
        <div style="margin-top: 10px;">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <i class="fa fa-file"></i> 附件
                </div>
                <div class="panel-body">
                    <div class="well">
                        <span><i class="fa fa-file-archive-o"></i> 已上传附件：</span>
                        <div ng-repeat="attachment in proposal.attachments">
                            <div>
                                <i class="fa fa-file-image-o"></i>{{attachment.filename}}  {{attachment.size}}KB
                            </div>
                        </div>
                    </div>
                    <div flow-init>
                        <div style="height: 30px">
                            <button type="button" class="btn btn-primary pull-right" flow-btn>选择文件</button>
                        </div>
                        <input type="file" flow-btn style="visibility: hidden">

                        <div class="well">
                            <div ng-repeat="file in $flow.files" class="transfer-box">
                                {{file.relativePath}} ({{file.size}}bytes)
                                <span class="label label-danger" ng-hide="file.error == false">文件上传出错!</span>

                                <div class="progress progress-striped" ng-class="{active: file.isUploading()}">
                                    <div class="progress-bar" role="progressbar"
                                         aria-valuenow="{{file.progress() * 100}}"
                                         aria-valuemin="0"
                                         aria-valuemax="100"
                                         ng-style="{width: (file.progress() * 100) + '%'}">
                                        <span class="sr-only">{{file.progress()}}% Complete</span>
                                    </div>
                                </div>

                                <div class="btn-group">
                                    <a class="btn btn-xs btn-warning" ng-click="file.pause()" ng-show="!file.paused && file.isUploading()">
                                        暂停
                                    </a>
                                    <a class="btn btn-xs btn-warning" ng-click="file.resume()" ng-show="file.paused && file.isUploading()">
                                        继续
                                    </a>
                                    <a class="btn btn-xs btn-danger" ng-click="file.cancel()">
                                        取消
                                    </a>
                                    <a class="btn btn-xs btn-info" ng-click="file.retry()" ng-show="file.error">
                                        重试
                                    </a>
                                </div>
                            </div>
                        </div>
                        <div class="well">
                            <a class="btn btn-small btn-success" ng-click="$flow.resume()">开始/继续上传</a>
                            <a class="btn btn-small btn-danger" ng-click="$flow.pause()">暂停所有</a>
                            <a class="btn btn-small btn-info" ng-click="$flow.cancel()">取消所有</a>
                            <a class="btn btn-small btn-primary" ng-click="postAttachment($flow)">完成上传</a>
                            <span class="label label-info pull-right">总大小: {{$flow.getSize()}}字节</span>
                        </div>
                    </div>
                </div>
            </div>
        </div><!-- 附件div结束 -->
    </div><!-- panel-body -->

    <div class="panel-footer">
        <div class="row">
            <div class="pull-right" style="margin-right: 10px">
                <button class="btn btn-primary"
                        type="button"
                        ng-click="saveAsDraft()"
                        ng-hide="isUpdate">
                    存入草稿
                </button>

                <button class="btn btn-danger"
                        type="button"
                        ng-show="isDraft"
                        ng-click="publishDraft()">
                    发布草稿
                </button>

                <button class="btn btn-primary" type="button" ng-click="publishProposal()">
                    {{title}}
                </button>
            </div>
        </div>
    </div>
</div>


<script>
    var editor = new wangEditor('textEditor');
    editor.config.uploadImgUrl = '../../uploadImages/';
    editor.create();
    $('#textEditor').css("height", "500px");
</script>